from django.shortcuts import render_to_response


@dmq_render_to(template='echo.tmpl')
def echo(req):
	"""
	If it's a dmq server, echo the params as JSON.
	Otherwise, return a web page that has the GET|POST
	params listed.
	"""

	params = {}
	if request.method == 'GET':
		params = request.GET
	elif request.method == 'POST':
		params = request.POST

	return {'params':params}
#echo

@dmq_only
def echo_puredmq(req):
	"""
	Assume it's a dmq request. Echo the params as JSON.
	The @dmq_only decorator will enforce the request/response
	objects used for us.
	"""

	params = {}
	if request.method == 'GET':
		params = request.GET
	elif request.method == 'POST':
		params = request.POST

	return {'params':params}
#echo_puredmq

def echo_purehttp(req):
	"""docstring for EchoPurehttp"""

	params = {}
	if request.method == 'GET':
		params = request.GET
	elif request.method == 'POST':
		params = request.POST
		
	return render_to_response('echo.tmpl', {'params':params})
#echo_purehttp
